<style>
	.layui-form input{
		width:400px;
	}
	.layui-layer-content{
		background: #040d33;
		color: white;
		font-size: 16px;
	}
	
	.layui-form-label{
		width: 90px;
		font-size: 18px;
	}
</style>
<div style="margin: 65px;" id="grade">
	<form class="layui-form" style="margin-left: 60px;">
	  <div class="layui-form-item">
	    <label class="layui-form-label">Username:</label>
	    <div class="layui-input-block">
	      <input type="text" name="USERNAME" placeholder="Please input mariadb username" class="input_text">
	    </div>
	  </div>
	   <div class="layui-form-item">
	    <label class="layui-form-label">Password:</label>
	    <div class="layui-input-block">
	      <input type="password" name="PASSWORD" placeholder="Please input mariadb password" class="input_text">
	    </div>
	  </div>
	   <div class="layui-form-item">
	    <label class="layui-form-label">IP:</label>
	    <div class="layui-input-block">
	      <input type="text" name="IP" placeholder="Please input node ip" class="input_text">
	    </div>
	  </div>
	   <div class="layui-form-item">
	    <label class="layui-form-label">Port:</label>
	    <div class="layui-input-block">
	      <input type="text" name="PORT" placeholder="Please input mariadb port" class="input_text">
	    </div>
	  </div>
	   <div class="layui-form-item">
	    <label class="layui-form-label">DBName:</label>
	    <div class="layui-input-block">
	      <input type="text" name="DBNAME" placeholder="Please input mariadb dbname" class="input_text">
	    </div>
	    <div class="layui-input-block" style="padding-left:10px;">
	    	<br>
	   		<a href="/api/downUserFiles/125983256989" style="color: #93aef0;">Download MariaDB</a>
	    </div>
	  </div>
	</form>
	<div class="" style="margin-left: 300px;margin-top: 40px;">
  		<button type="button" style="border:1px solid #1441c1;color: #0fffff;width: 146px;height: 44px;background: #041252;" onclick="upnode()" >SUBMIT</button>
	</div>
</div>
<script>
	function upnode(){
		var name = $("#grade input[name='USERNAME']").val();
		var password = $("#grade input[name='PASSWORD']").val();
		var ip = $("#grade input[name='IP']").val();
		var port = $("#grade input[name='PORT']").val();
		var dbname = $("#grade input[name='DBNAME']").val();
		if(name == "" || password == "" || ip == "" || port == "" || dbname == ""){
			layer.msg("Please enter the corret parameters !");
			return;
		}
		var config ={ url:"/api/initNode",
				  data:{
					  u:name,
					  p:password,
					  ip:ip,
					  port:port,
					  db:dbname
				  },
				  callBackFunc:function(res){
					  if(res.data){
						  layer.msg("Submit successfully !");
						  ui.closeWin();
						  userInfo();
					  }else{
						  layer.msg("Submit error , Node params validation failed !");
					  }
				  }
				};
		HD.doPost(config);
	}

</script>